<?php

if (isset($_REQUEST['reset']) and $_REQUEST['reset'] == 'true') {
	if (isset($_SESSION['login']) and time() - $_SESSION['login']['timestamp'] < $env['timeout']) {
		$_SESSION['login']['timestamp'] = time();
	} else {
		unset($_SESSION['login']);
	}
}

if (isset($_SESSION['login'])) {
	echo json_encode(array('timeout' => $env['timeout'] - (time() - $_SESSION['login']['timestamp'])));
} else {
	echo 0;
}
